/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mynet;

/**
 *
 * @author suvam
 */
import java.net.*;
 import java.io.*;

 public class srvr1 {
 public static void main(String args[]) {
 ServerSocket s = null;

 // Register your service on port 5432
try {
 s = new ServerSocket(5432);
 } catch (IOException e) {
 e.printStackTrace();
 }
// Run the listen/accept loop forever
 while (true) {
 try {
 // Wait here and listen for a connection
 Socket s1 = s.accept();

 // Get output stream associated with the socket
 OutputStream s1out = s1.getOutputStream();
 BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s1out));

 // Send your string!
 bw.write("Hello Net World!");
 // Close the connection, but not the server socket
 bw.close();
 s1.close();

 } catch (IOException e) {
 e.printStackTrace();
 } // END of try-catch

 } // END of while(true)

 } // END of main method

} // END of SimpleServer program